package com.itheima.dao;

import com.itheima.pojo.File;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;


public interface FileMapper extends Mapper<File> {

    /**
     *根据uid获取url
     * @param fileUid
     * @return
     */
    @Select("select pic_url from t_file where uid=#{fileUid}")
    String getPicUrlByUid(@Param("fileUid") String fileUid);

    /**
     *根据uid获取file对象
     * @param fileUid
     * @return
     */
    @Select("select uid,file_old_name fileOldName,pic_name picName,pic_url picUrl,pic_expanded_name picExpandedName from t_file where uid=#{fileUid}")
    File getFileByUid(@Param("fileUid") String fileUid);

    @Select("select pic_url from t_file where uid=#{avatar}")
    String getPicUrl2ByUid(@Param("avatar") String avatar);

    /**
     * 根据用户uid获取pic_url
     * @param userUid
     * @return
     */
    @Select("select pic_url from t_file where user_uid=#{userUid}")
    String getUrlByUserUid(@Param("userUid") String userUid);
}
